﻿// Copyright 2010 Maxime Serrano <lastchronicler@gmail.com>
using System;

namespace MCSharp {
    public struct BlockInfo {
        public Block type;
        public byte info;
        public BlockInfo(Block type, byte info) {
            this.type = type;
            this.info = info;
        }
        public BlockInfo(byte type, byte info) {
            this.type = (Block)type;
            this.info = info;
        }
    }

    public struct Blocks {
        public static readonly BlockInfo[] LightEmittingBlocks = new BlockInfo[] {
            // These values are just guesses. They aren't verified as correct.
            new BlockInfo(Block.Torch, 0x0F),
            new BlockInfo(Block.RedstoneTorchOn, 0x06),
            new BlockInfo(Block.LightedRedstoneOre, 0x06),
            new BlockInfo(Block.BurningFurnace, 0x06),
            new BlockInfo(Block.Fire, 0x0F),
            new BlockInfo(Block.Lava, 0x0F),
            new BlockInfo(Block.MobSpawner, 0x06)
        };

        // These are guesses too, but are probably correct.
        public static readonly Block[] LightCarryingBlocks = new Block[] {
            Block.Air,
            Block.Water,
            Block.Lava,
            Block.StillWater,
            Block.StillLava,
            Block.RedFlower,
            Block.YellowFlower,
            Block.Plant,
            Block.RedMushroom,
            Block.BrownMushroom,
            Block.Leaves,
            Block.Glass,
            Block.Ice,
            Block.Crop,
            Block.Lever,
            Block.RedstoneTorchOff,
            Block.RedstoneTorchOn,
            Block.Torch,
            Block.WoodenDoor,
            Block.IronDoor,
            Block.WoodenPressurePlate,
            Block.WoodenStairs,
            Block.StonePressurePlate,
            Block.CobblestoneStairs,
            Block.StoneButton,
            Block.Reed,
            Block.Stair,
            Block.Sign,
            Block.SignPost,
            Block.Snow,
            Block.Rail,
            Block.Fence,
            Block.Ladder
        };

        public static readonly Block[] SkyLightCarryingBlocks = new Block[] {
            Block.Air,
            Block.RedFlower,
            Block.YellowFlower,
            Block.Plant,
            Block.RedMushroom,
            Block.BrownMushroom,
            Block.Glass,
            Block.Crop,
            Block.Lever,
            Block.RedstoneTorchOff,
            Block.RedstoneTorchOn,
            Block.Torch,
            Block.WoodenDoor,
            Block.IronDoor,
            Block.WoodenPressurePlate,
            Block.WoodenStairs,
            Block.StonePressurePlate,
            Block.CobblestoneStairs,
            Block.StoneButton,
            Block.Reed,
            Block.Stair,
            Block.Sign,
            Block.SignPost,
            Block.Snow,
            Block.Rail,
            Block.Fence,
            Block.Ladder
        };
    }

    public enum Block {
        Undefined = 255, // for error checking

        Air = 0,
        Stone = 1,
        Grass = 2,
        Dirt = 3,
        Rocks = 4,
        Wood = 5,
        Plant = 6,
        Admincrete = 7,
        Water = 8,
        StillWater = 9,
        Lava = 10,
        StillLava = 11,
        Sand = 12,
        Gravel = 13,
        GoldOre = 14,
        IronOre = 15,
        Coal = 16,
        Log = 17,
        Leaves = 18,
        Sponge = 19,
        Glass = 20,

        Cloth = 35,

        YellowFlower = 37,
        RedFlower = 38,
        BrownMushroom = 39,
        RedMushroom = 40,

        Gold = 41,
        Steel = 42,
        DoubleStair = 43,
        Stair = 44,
        Brick = 45,
        TNT = 46,
        Books = 47,
        MossyRocks = 48,
        Obsidian = 49,

        Torch = 50,
        Fire = 51,
        MobSpawner = 52,
        WoodenStairs = 53,
        Chest = 54,
        RedstoneWire = 55,
        DiamondOre = 56,
        Diamond = 57,
        Workbench = 58,
        Crop = 59,
        Soil = 60,
        Furnace = 61,
        BurningFurnace = 62,
        SignPost = 63,
        WoodenDoor = 64,
        Ladder = 65,
        Rail = 66,
        CobblestoneStairs = 67,
        Sign = 68,
        Lever = 69,
        StonePressurePlate = 70,
        IronDoor = 71,
        WoodenPressurePlate = 72,
        RedstoneOre = 73,
        LightedRedstoneOre = 74,
        RedstoneTorchOff = 75,
        RedstoneTorchOn = 76,
        StoneButton = 77,
        Snow = 78,
        Ice = 79,
        SnowBlock = 80,
        Cactus = 81,
        Clay = 82,
        Reed = 83,
        Jukebox = 84,
        Fence = 85
    }
}
